import {
  defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    host: '127.0.0.1',
    port: 3036,
    proxy: {
      '/api': {
        target: 'http://pur.ppcg.com.cn', //实际请求地址 
        // target: 'http://192.168.6.73:18084', // 曹佳佳本地
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
    }
  },
  // 配置打包体积大小警告
  build: {
    chunkSizeWarningLimit: 1500,
    output: {
      manualChunks(id) { // 分包
        if (id.includes('node_modules')) {
          return id.toString().split('node_modules/')[1].split('/')[0].toString();
        }
      }
    }
  }

})